import * as api from '@/api/search';

export default {
  namespaced: true,
  state: {
    // 获取搜索建议
    list: [],
  },
  mutations: {
    // 获取搜索建议
    setList(state, newValue) {
      state.list = newValue;
    },
  },
  actions: {
    // 获取搜索建议
    async updateList(ctx, value) {
      const res = await api.getSuggestList(value);
      ctx.commit('setList', res);
    },
  },
}